
describe("PublicLoginView", function(){

    var publicLoginView = null, publicLoginController = null;

    beforeEach(function(){

        publicLoginController = App.PublicLoginController.create();
        publicLoginView = App.PublicLoginView.create();
        publicLoginView.set('controller', publicLoginController);
    });

    describe("keyUp method test", function(){

        var event = null;
        beforeEach(function(){
            spyOn(publicLoginController, 'get').andReturn("user");
            spyOn(publicLoginController, 'verifyInputs').andReturn(true);
        });
        afterEach(function(){
            expect(publicLoginController.verifyInputs).toHaveBeenCalled();
        });

        it("eventManager keyUp method test - Press enter", function(){

            event = {keyCode : 13};
            spyOn(publicLoginController, 'submitLogin').andReturn(true);
            publicLoginView.eventManager.keyUp(event, publicLoginView);
            expect(publicLoginController.submitLogin).toHaveBeenCalled();
        });
    });

});
